package context;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserContext {
    private static final ThreadLocal<Long> tl = new ThreadLocal<>();

    public static void setId(Long id) {
        log.info("设置用户id: {}", id);
        tl.set(id);
    }

    public static Long getId() {
        return tl.get();
    }

    public static void clear() {
        tl.remove();
    }
}
